home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1146 / 1146.xpi / chrome / screengrab.jar / content / Clipboard.js < prev    next >
Text File  |  2009-03-09  |  950b  |  26 lines

  1. screengrab.Clipboard = {
  2.     putImgDataUrl : function(dataUrl, callbackWhenDone) {
  3.         var image = window.content.document.createElement("img");
  4.         image.setAttribute("style", "display: none");
  5.         image.setAttribute("id", "screengrab_buffer");
  6.         image.setAttribute("src", dataUrl);
  7.         var body = window.content.document.getElementsByTagName("html")[0];
  8.         body.appendChild(image);
  9.         setTimeout(this.copyImage(image, body, document, callbackWhenDone), 200);
  10.     },
  11.     
  12.     copyImage : function(image, body, documenty, callbackWhenDone) {
  13.         return function () {
  14.             documenty.popupNode = image;
  15.             try {
  16.                 goDoCommand('cmd_copyImageContents');
  17.             } catch (ex) {
  18.                 alert(ex);
  19.             }
  20.             body.removeChild(image);
  21.             if (callbackWhenDone) {
  22.                 callbackWhenDone();
  23.             }
  24.         };
  25.     }
  26. }